import resquest from '@/utils/request'
export default {
  namespaced: true,
  state () {
    return {
      waiters: []
    }
  },
  mutations: {
    SET_WAITER (state, payload) {
      state.waiters = payload
    }
  },
  actions: {
    async findAllWaiters ({ commit }) {
      let res = await resquest.get('/baseUser/cascadeRoleFindAll')
      let waiters = res.data.filter(user => {
        return user.roles[0].name == '员工'
      })
      commit('SET_WAITER', waiters)
    }
  }
}